package com.yzy.controller;

import com.yzy.dao.DoctorDao;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class DoctorjiuzhenServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String pphone;
        ServletContext application = request.getServletContext();
        String DlongindidString= (String) application.getAttribute("Dlongindid");
        Integer Dlongindid=Integer.valueOf(DlongindidString);
        DoctorDao dao=new DoctorDao();
        int result=0;
        PrintWriter out=null;
        //1.调用请求对象
        pphone = request.getParameter("pphone");
        //2
        result = dao.updatejiuzhen(pphone,Dlongindid);
        //3
        response.setContentType("text/html;charset=utf-8");
        out=response.getWriter();
        System.out.println(result);
        if(result ==1){
            out.print("<font style='color:red;font-size:40'>患者就诊成功</font>");
        }else{
            out.print("<font style='color:red;font-size:40'>患者就诊失败</font>");
        }
    }

}
